Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.default = void 0, exports.get = r, exports.post = s, exports.request = e;

var t = getApp();

function e(e) {
    var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null, s = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "GET";
    return s = String(s).toLowerCase(), new Promise(function(o, n) {
        var a = {
            url: t.getNetAddresss(e),
            success: function(t) {
                var e = t.data, s = e.result, a = e.msg, u = e.data;
                0 != s ? o(u) : n({
                    result: s,
                    msg: a,
                    data: r
                });
            },
            fail: function(t) {
                n(t);
            }
        };
        switch (r && (a.data = r), s) {
          case "post":
            t._postNetWork(a);
            break;

          case "get":
            t._getNetWork(a);
        }
    });
}

function r(t) {
    var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
    return e(t, r, "get");
}

function s(t) {
    var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
    return e(t, r, "post");
}

var o = {
    request: e,
    get: r,
    post: s
};

exports.default = o;